package com.smasher.domain.entity

import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "domains")
data class BeanDomain(
    @PrimaryKey(autoGenerate = true)
    val id: Int,
    val name: String = "",
    val scheme: String = "",
    val host: String = "",
    val port: Int = 0
) {
    @Transient
    var select: Boolean = false

    override fun toString(): String {
        return "BeanDomain(name='$name', scheme='$scheme', host='$host', port=$port)"
    }

    override fun equals(other: Any?): Boolean {
        if (other == null) return false
        if (other is BeanDomain) {
            if (other.scheme == scheme && other.host == host && other.port == port) {
                return true
            }
        }
        return false
    }
}
